import json


filename='number.json'
try:
    with open(filename) as f_ob:
        number=json.load(f_ob)
except FileNotFoundError:
    number=input('What is your favorite number ')
    with open(filename,'w') as f_ob:
        json.dump((number,f_ob))
        print('I knowyour favorite number! It is '+number)
else:
    print('请输入你喜欢的数字')